package ysq.xyg.web.model.po;

import lombok.NoArgsConstructor;

import lombok.Data;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;
import ysq.xyg.sys.model.po.SysUser;

import javax.annotation.Resource;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 业务模块-聊天信息实体类
 *
 * @author shengQiang yu
 * @date 2019-9-5 11:46:48
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_web_chat")
public class WebChat implements Serializable{

	/**
     * 主键
     */ 
	@Id
	private String id;
	
	/**
     * 发送人id
     */ 
	@Column(name = "send_id")
	private String sendId;
	
	/**
     * 接收人id
     */ 
	@Column(name = "receiver_id")
	private String receiverId;
	
	/**
     * 消息类型:1、文本，2、图片，3、语音，4、视频
     */ 
	@Column(name = "msg_type")
	private String msgType;
	
	/**
     * 昵称
     */ 
	@Column(name = "content")
	private String content;
	
	/**
     * 删除标注:1、正常，2、删除
     */ 
	@Column(name = "remove_tag")
	private String removeTag;
	
	/**
     * 创建时间
     */ 
	@Column(name = "create_time")
	private Date createTime;
	
	/**
     * 创建人
     */ 
	@Column(name = "create_user")
	private String createUser;
	
	/**
     * 修改时间
     */ 
	@Column(name = "update_time")
	private Date updateTime;
	
	/**
     * 修改人
     */ 
	@Column(name = "update_user")
	private String updateUser;

	/**
	 * 发送人
	 */
	@Transient
	private String sendName;
	/**
	 * 发送人头像
	 */
	@Transient
	private String sendLogo;
	/**
	 * 接收人
	 */
	@Transient
	private String receiverName;

	/**
	 * 接收人头像
	 */
	@Transient
	private String receiverLogo;


	public WebChat(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}